<html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms"
	xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns="http://www.w3.org/1999/xhtml" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
	xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xi="http://www.w3.org/2001/XInclude"
	xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:saxon="http://saxon.sf.net/">
	<head>
		<title>Numishare: Edit Index</title>
		<link type="text/css" href="http://localhost:8080/cocoon/numishare/xforms.css"
			rel="stylesheet"/>
		<xforms:model>
			<xforms:instance id="site-info">
				<site_info xmlns="">
					<title/>
					<banner_text/>
					<footer/>
					<url/>
					<orbeon_url/>
					<eadheader_url/>
					<archdesc_did_url/>
					<solr_url/>
					<images>
						<absolute_path/>
						<thumbnail/>
						<screen/>
					</images>
				</site_info>
			</xforms:instance>

			<xforms:instance id="status">
				<status/>
			</xforms:instance>
			
			<!--<xforms:instance id="serialized-footer">
				<div xmlns=""/>
			</xforms:instance>-->

			<xforms:action ev:event="xforms-model-construct-done">
				<xforms:send submission="load-submission"/>
				<!--<xforms:setvalue ref="instance('serialized-footer')"
					value="saxon:serialize(instance('site_info')/footer, 'html')"/>-->
			</xforms:action>
			
			<!--<xforms:action ev:event="xforms-ready">
				<xforms:setvalue ref="instance('serialized-footer')"
					value="saxon:serialize(instance('site_info')/footer, 'html')"/>
			</xforms:action>-->
	
			

			<xforms:bind nodeset="instance('site-info')">
				<xforms:bind nodeset="title" required="true"/>
				<xforms:bind nodeset="banner_text" required="true"/>
				<xforms:bind nodeset="url" required="true"/>
				<xforms:bind nodeset="orbeon_url" required="true"/>
				<xforms:bind nodeset="eadheader_url" required="true"/>
				<xforms:bind nodeset="archdesc_did_url" required="true"/>
				<xforms:bind nodeset="solr_url" required="true"/>
				<xforms:bind nodeset="images">
					<xforms:bind nodeset="thumbnail" required="true" type="xs:integer"/>
					<xforms:bind nodeset="screen" required="true" type="xs:integer"/>
				</xforms:bind>
			</xforms:bind>

			<!-- Load File -->
			<xforms:submission id="load-submission" serialization="none" method="get"
				action="/exist/rest/db/numishare/site_info.xml" xxforms:username="admin"
				xxforms:password="admin" replace="instance" instance="site-info">
				<!--<xforms:setvalue ref="instance('serialized-footer')" ev:event="xforms-submit-done"
					value="saxon:serialize(instance('site_info')/footer, 'xml')"/>-->
			</xforms:submission>

			<!-- Save File -->
			<xforms:submission id="save-submission" ref="instance('site-info')"
				xxforms:username="admin" xxforms:password="admin"
				action="/exist/rest/db/numishare/site_info.xml" method="put" replace="none">
				<xforms:setvalue ev:event="xforms-submit-done" ref="instance('status')">Site
				Information Saved</xforms:setvalue>				
				<xforms:message ev:event="xforms-submit-error" level="modal">Save
					Error!</xforms:message>
			</xforms:submission>
		</xforms:model>

	</head>
	<body>
		<div class="form">
			<xforms:group ref="instance('status')/text()">
				<div class="success">
					<xforms:output ref="instance('status')"/>
				</div>
			</xforms:group>
			<div class="submission">
				<xforms:submit submission="save-submission" appearance="minimal">
					<xforms:label class="file_control"><img src="/apps/numishare/images/save.gif"
							alt="Save"/> Save</xforms:label>
				</xforms:submit>
			</div>
			<xforms:group ref="instance('site-info')">
				<div class="section">
					<h3>Titles and URLs</h3>
					<div>
						<xforms:input ref="title">
							<xforms:label>Title</xforms:label>
							<xforms:alert>Required</xforms:alert>
						</xforms:input>
						<p>The title of the site to be displayed in all web page titles and
							citations in PDF files.</p>
					</div>
					<div>
						<xforms:input ref="banner_text">
							<xforms:label>Banner Text</xforms:label>
							<xforms:alert>Required</xforms:alert>
						</xforms:input>
						<p>Appears in the header banner. For more sophisticated control, edit
							header.xsl.</p>
					</div>
					<!--<div>
						<h4>Footer</h4>
						<xforms:textarea ref="footer/div[@id='ft']" mediatype="text/html"/>
					</div>-->
					<div>
						<xforms:input ref="url">
							<xforms:label>URL</xforms:label>
							<xforms:alert>Required</xforms:alert>
						</xforms:input>
						<p>Public URL of the site. Used in citations of and image references in PDF
							printouts. Changing this to an inactive URL will <b>not</b> break
							Numishare's core functionality, but web forms may be style-less since
							the Orbeon applications point to this URL for embedding css files.</p>
					</div>
				</div>
				<xforms:group ref="images">
					<div class="section">
						<h3>Image Configuration</h3>
						<div>
							<xforms:input ref="thumbnail">
								<xforms:label>Thumbnail dimensions</xforms:label>
								<xforms:alert>Required, must be integer.</xforms:alert>
							</xforms:input>
							<p>Maximum height or width of thumbnails.</p>
						</div>
						<div>
							<xforms:input ref="screen">
								<xforms:label>Screen dimensions</xforms:label>
								<xforms:alert>Required, must be integer.</xforms:alert>
							</xforms:input>
							<p>Maximum height or width of screen sized images which display on item
								records and pop up in the search results.</p>
						</div>
						<div>
							<xforms:input ref="absolute_path">
								<xforms:label>Image Path</xforms:label>
								<xforms:alert>Required</xforms:alert>
							</xforms:input>
							<p>Absolute path to the image folder on the server.</p>
						</div>
					</div>
				</xforms:group>
				<div class="section">
					<h3>Advanced Options</h3>
					<p>
						<b>Only change these options if Orbeon is run on a separate server.</b>
					</p>
					<p>Changing these options to an inactive URL could break public coin display and
						web form functionality. A backup file is located in the
						tomcat/webapps/cocoon/numishare/xml folder and must be uploaded to eXist in
						the event of site malfunction.</p>
					<div>
						<xforms:input ref="orbeon_url">
							<xforms:label>Orbeon URL</xforms:label>
							<xforms:alert>Required</xforms:alert>
						</xforms:input>
					</div>
					<div>
						<xforms:input ref="eadheader_url">
							<xforms:label>EAD Header URL</xforms:label>
							<xforms:alert>Required</xforms:alert>
						</xforms:input>
					</div>
					<div>
						<xforms:input ref="archdesc_did_url">
							<xforms:label>Archdesc URL</xforms:label>
							<xforms:alert>Required</xforms:alert>
						</xforms:input>
					</div>
					<div>
						<xforms:input ref="solr_url">
							<xforms:label>Solr URL</xforms:label>
							<xforms:alert>Required</xforms:alert>
						</xforms:input>
						<p>If Solr is run on a different server or core than the default, the Cocoon
							sitemap global variable must be edited manually in addition to this URL,
							which is referenced in Orbeon web forms.</p>
					</div>
				</div>
			</xforms:group>
			<!--<widget:xforms-instance-inspector id="orbeon-xforms-inspector"
				xmlns:widget="http://orbeon.org/oxf/xml/widget"/>-->
		</div>
	</body>
</html>
